package com.gadgets;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication
@PropertySource(value = {
        "classpath:/config/spring-runningEnv.spring.properties",
        "classpath:/config/application-${gadgets.running.type}-name.properties"
})
@EnableCaching
public class EurekaServerApplicationStart extends SpringBootServletInitializer {

    /**
     * Configure the application. Normally all you would need to do is to add sources
     * (e.g. config classes) because other settings have sensible defaults. You might
     * choose (for instance) to add default command line arguments, or set an active
     * Spring profile.
     *
     * @param builder a builder for the application context
     * @return the application builder
     * @see SpringApplicationBuilder
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(
                GadgetsServiceCenterStart.class
        );
    }

    public static void main(String[] args) {
        SpringApplication.run(new Class[]{
                GadgetsServiceCenterStart.class
        }, args);
    }

}
